﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using JA.Negocios;

namespace JA.Web.Apresentacao
{
    public partial class BackOffice : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            UsuarioVO usuarioVO = (UsuarioVO)this.Session["userActive"];

            if (usuarioVO == null)
            {
                this.PanelLogin.Visible = true;
            }
            else
            {
                this.LiteralUsuario2.Text = "Backoffice Site José Imóveis - Área restrita - " + usuarioVO.usuario;
                string nomeDoControle = this.Request["controle"];
                if (nomeDoControle != null)
                {
                    ((HyperLink)this.FindControl(nomeDoControle)).CssClass = "active";
                }

                if (!IsPostBack)
                {
                    this.hlCadUsu.Visible = usuarioVO.cadUsu;
                    this.hlCadPar.Visible = usuarioVO.cadPar;
                    this.hlCadEst.Visible = usuarioVO.cadEst;
                    this.hlCadCid.Visible = usuarioVO.cadCid;
                    this.hlCadBai.Visible = usuarioVO.cadBai;
                    this.hlCadCli.Visible = usuarioVO.cadCli;
                    this.hlCadCar.Visible = usuarioVO.cadCar;
                    this.hlCadCom.Visible = usuarioVO.cadCom;
                    this.hlCadTip.Visible = usuarioVO.cadTip;
                    this.hlCadCat.Visible = usuarioVO.cadCat;
                    this.hlCadImo.Visible = usuarioVO.cadImo;
                    this.hlCadFot.Visible = usuarioVO.cadFot;
                    this.hlCadLnk.Visible = usuarioVO.cadLnk;
                    this.hlCadCtt.Visible = usuarioVO.cadCtt;
                }
            }

        }

        protected void btEncerrarSessaoClick(object sender, EventArgs e)
        {
            this.Session["userActive"] = null;
            this.Response.Redirect("~/BackOffice.aspx");
        }
    }
}
